package question17;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.TreeSet;

public class question17 {

    static TreeSet<int[]> treeSet = new TreeSet<>(new Comparator<int[]>() {
        @Override
        public int compare(int[] o1, int[] o2) {
            return o1[0] == o2[0] ? o1[1] - o2[1] : o1[0] - o2[0];
        }
    });

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int[] arr1 = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::valueOf).toArray();
        int[] arr2 = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::valueOf).toArray();

//        exchangeSum(new int[]{4,1,2,1,1,2}, new int[]{3,6,3,3});

        exchangeSum(arr1, arr2);
        StringBuilder sb = new StringBuilder();
        treeSet.forEach(item -> {
            sb.append(item[0] + " " + item[1] + "\n");
        });
        System.out.println(sb.toString());
    }

    public static void exchangeSum(int[] arr1, int[] arr2) {
        int sum1 = Arrays.stream(arr1).sum();
        int sum2 = Arrays.stream(arr2).sum();
        int cha = Math.abs(sum1 - sum2);

        for (int i = 0; i < arr1.length; i++) {
            for (int j = 0; j < arr2.length; j++) {
                if (Math.abs(arr1[i] - arr2[j]) == cha/2) {
                    treeSet.add(new int[]{arr1[i], arr2[j]});
                }
            }
        }
    }
}
